<?php
/**
 * Created by PhpStorm.
 * User: nightelf
 * Date: 2020/1/29
 * Time: 11:27
 */

namespace App\Http\Model;


use Illuminate\Support\Facades\DB;

class FinanceLiquidationModel
{
    const TABLE = 'finance_liquidation';

    /**
     * @param $id
     * @return array
     */
    public function info($id)
    {
        $result = DB::table(self::TABLE)->where(['employeeId'=>$id])->first();
        return empty($result) ? [] : get_object_vars($result);
    }

    /**
     * @param array $data
     * @return mixed
     */
    public function insert(array $data)
    {
        return DB::table(self::TABLE)->insert($data);
    }

    /**
     * @param array $data
     * @return mixed
     */
    public function getSum(array $data)
    {
        return DB::table(self::TABLE)->where($data)->sum('account');
    }
}